<?php

namespace App\Admin\Controllers;

use App\Common\Models\Db1\MpPayment;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class MpPaymentController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = 'App\Common\Models\Db1\MpPayment';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new MpPayment());

        $grid->column('id', __('Id'));
        $grid->column('mchid', __('Mchid'));
        //$grid->column('partner_key', __('Partner key'));
        //$grid->column('apiclient_cert', __('Apiclient cert'));
        //$grid->column('apiclient_key', __('Apiclient key'));
        $grid->column('created_at', __('Created at'));
        $grid->column('updated_at', __('Updated at'));
        $grid->column('intro', __('Intro'));

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(MpPayment::findOrFail($id));

        $show->field('id', __('Id'));
        $show->field('mchid', __('Mchid'));
        $show->field('partner_key', __('Partner key'));
        $show->field('apiclient_cert', __('Apiclient cert'));
        $show->field('apiclient_key', __('Apiclient key'));
        $show->field('created_at', __('Created at'));
        $show->field('updated_at', __('Updated at'));
        $show->field('intro', __('Intro'));

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new MpPayment());

        $form->text('mchid', __('Mchid'));
        $form->text('partner_key', __('Partner key'));
        $form->textarea('apiclient_cert', __('Apiclient cert'));
        $form->textarea('apiclient_key', __('Apiclient key'));
        $form->textarea('intro', __('Intro'));

        return $form;
    }
}
